package csd.wyaiyr.com.config;

import io.swagger.v3.oas.annotations.media.Schema;

import java.util.Date;


public class BaseResultPage<T> extends BaseResult {

//分页信息

    @Schema(name = "page",description = "分页信息")
    private PageInfoResult page;

    public PageInfoResult getPage() {
        return page;
    }

    

    public void setPage(PageInfoResult page) {
        this.page = page;
    }

    public BaseResultPage() {
    }

    public BaseResultPage(PageInfoResult page) {
        this.page = page;
    }

    public BaseResultPage(String msg, PageInfoResult page) {
        super(msg);
        this.page = page;
    }

    public BaseResultPage(int code, boolean success, String msg, String timestamp, PageInfoResult page) {
        super(code, success, msg, timestamp);
        this.page = page;
    }

    public BaseResultPage(int code, boolean success, String msg, Object data, String timestamp) {
        super(code, success, msg, data, timestamp);
    }

    public BaseResultPage(int code, boolean success, String msg, Object data, String timestamp, PageInfoResult page) {
        super(code, success, msg, data, timestamp);
        this.page = page;
    }

    public BaseResultPage(int code, boolean success, String msg, Object data, String timestamp, PageInfoResult page, PageInfoResult page1) {
        super(code, success, msg, data, timestamp, page);
        this.page = page1;
    }

    public static BaseResultPage ok(Object data, PageInfoResult page){
        BaseResultPage baseResultPage = new BaseResultPage(200,true,"成功", data, new Date().getTime()+"",page);
        return baseResultPage;
    }

    public static BaseResultPage error(String errMsg){
        BaseResultPage baseResult = new BaseResultPage(500,false,errMsg,null, new Date().getTime()+"");
        return baseResult;
    }

    public static BaseResultPage error(int code,String errMsg){
        BaseResultPage baseResult = new BaseResultPage(code,false,errMsg,null, new Date().getTime()+"");
        return baseResult;
    }


}
